package com.zh.kotlin_mvvm.ui

import android.os.Bundle
import com.zh.common.base.BaseActivity
import com.zh.kotlin_mvvm.databinding.ActivityRxFfmpegBinding
import io.microshow.rxffmpeg.RxFFmpegCommandList
import io.microshow.rxffmpeg.RxFFmpegInvoke
import io.microshow.rxffmpeg.RxFFmpegSubscriber


class RxFFmpegActivity : BaseActivity<ActivityRxFfmpegBinding>() {

    private val subscriber by lazy { MyRxFFmpegSubscriber() }

    override fun initView(savedInstanceState: Bundle?) {
        val commands = RxFFmpegCommandList()
        RxFFmpegInvoke.getInstance().runCommandRxJava(commands.build()).subscribe(subscriber)
    }

    private inner class MyRxFFmpegSubscriber : RxFFmpegSubscriber() {

        override fun onFinish() {

        }

        override fun onProgress(progress: Int, progressTime: Long) {

        }

        override fun onCancel() {

        }

        override fun onError(message: String) {

        }
    }

    override fun onDestroy() {
        super.onDestroy()
        subscriber.dispose()
    }
}